Developer Documentation
PATH  WebObjects 4.0 Documentation > Serving WebObjects

Table of Contents Previous Section

Performance Testing

WebObjects comes with a set of tools that allows you to record a session and then play it back. Using these tools, you can test your application setup to determine whether you have the appropriate number of instances running, the appropriate amount of memory allocated, and so on. The performance tools include:

The recording tools are not designed to handle automated functional testing, only performance testing. They simply save requests and play them back after substituting the appropriate session and context identifiers. This means that the playback tool expects the application to return the same page and content and when it was recorded.

This section focuses on recording and playing back sessions from the command line. For information on the Playback Manager application, consult the application's online help.

Recording a Session

When a WebObjects application is launched in recording mode, it saves each request and response made to a recording file (which has an extension of .rec). You specify the path designating this file with the -WORecordingPath flag, which also serves as a switch to turn on recording. The application automatically appends the .rec extension to the given filename and creates a directory, if one doesn't exist, with the given path.

To run an application in recording mode:

  1. Start the application on a command line similar to the following:
    myApplication -WOAutoOpenInBrowser NO -WORecordingPath 
    /tmp/TestMyApp/tape1
    

    This command creates the file /tmp/TestMyApp/tape1.rec.

  2. Using a web browser, run a session of your WebObjects application.

    You might want to record what you believe to be a typical session, or you might want to record a session that puts a maximum load on your application. For example, you may want to record a session that performs as many database fetches as possible. As you run the application, the WebObjects recording adaptor writes each request and response to the recording file.

    Keep in mind that all request and responses are saved to disk, so it's recommended that only one user (that is, one session) access the application while recording is underway. You can later play back a recorded session multiple times to simulate more users.

  3. Stop the application to stop recording

Playing Back a Session

Once you have recorded a session with your application, you can use the Playback command-line tool to simulate users accessing the application. This Java tool is part of the PlaybackManager project, which must be compiled for the tool to exist.

To play back a recorded session:

The Playback tool plays the recorded session repeatedly until you explicitly stop it (for example, by pressing Control-C in a command shell window). You can run several instances of the tool at the same time to put more load on the server. To manage multiple instances it's better to use the Playback Manager application.

If you want, you can specify other options of the Playback tool. The following list describes these options:

-h hostname
Sets the host to send the requests to (the default is localhost).

-p adaptorPath
Sends requests using the specified adaptor path instead of the recorded URL. For example, suppose you recorded a session using a Netscape server whose cgi-bin directory is named cgi-bin and you want to play it back using the Microsoft Internet Information Server, whose cgi-bin directory is named Scripts and whose adaptor is named WebObjects.dll. Your adaptor path is /Scripts/WebObjects.dll.

-port portNumber
Sets the port the requests are sent to (the default is 80).

-c limit
Limits the number of times to repeat the session playback (there is no limit by default).

-s sleepTime
Sets the interval between requests in seconds (the default is zero).

-diff percents
Sets the percentage difference between received and recorded response sizes (the default is 5%).

-d
Turns debugging on.

-r recordingDir
Sets the recording directory.

-help
Prints a summary of options
Here is an example of a command beginning a playback session using direct connect:

java -classpath com.apple.client.playback.Playback -d -h mymachine -r 
/tmp/tape1.rec -port 3456 -diff 20

Table of Contents Next Section